package cn.leestudio.leelibrary.rest;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.util.Log;

import org.junit.Test;
import org.junit.runner.RunWith;

import cn.leestudio.restlib.RestCallback;
import cn.leestudio.leelibrary.rest.bussness.bean.GetRecommendListReturn;
import cn.leestudio.leelibrary.rest.bussness.bean.ResponseData;
import cn.leestudio.restlib.Rest;
import cn.leestudio.leelibrary.rest.bussness.RestApi;

import static org.junit.Assert.*;

/**
 * Instrumentation test, which will execute on an Android device.
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
    @Test
    public void useAppContext() throws Exception {
        // Context of the app under test.
        Context appContext = InstrumentationRegistry.getTargetContext();
        Log.e("DemoTest","onSuccess -> ");
        assertEquals("cn.leestudio.leelibrary.rest", appContext.getPackageName());
        RestApi api = new Rest().create(RestApi.class);
        api.test6("1", "2", "xxx","星星", new RestCallback<ResponseData<GetRecommendListReturn>>() {

            @Override
            public void onSuccess(ResponseData<GetRecommendListReturn> hashMapResponseData) {
                Log.e("DemoTest","onSuccess -> "+hashMapResponseData.getResult().getList().get(0).getTitle());
            }
        });
    }
}
